// author: Dmitriy Zabranskiy 2012(c)
//

import java.text.DecimalFormat;
import java.util.Random;

public class Tutor {
    // Tutor and everything associated with it
	private static Random random = new Random();
	private String full_name;
	private double priority = 0;  // Priority to the satisfaction of his wishes
	private boolean[] wishes = new boolean[30];  // Wishes about the days on which he was comfortable to teach
    // 6 days, 5 pairs respectively
	public Tutor(String name) {
		this.full_name = name;
		this.priority = random.nextDouble(); // between 0 and 1
		for (int j = 0; j < 30; j++) {
			wishes[j] = random.nextBoolean();
		}
	}

	public String getName() {
		return full_name;
	}
    
    public boolean[] getWishes() {
    	return wishes;
    }
    
    public void setPriority(double newPrio) {
    	priority = newPrio;
    }
    
    public void setWishes(boolean[] newWishes) {
        System.arraycopy(newWishes, 0, wishes, 0, 30);
    }

	public double getPriority() {
		return priority;
	}

	@Override
	public boolean equals(Object o) {
		return ((Tutor) o).full_name.equals(this.full_name);
	}

	@Override
	public String toString() {
		StringBuilder str = new StringBuilder();
		str.append("priority: ");
		DecimalFormat df = new DecimalFormat("#.###");
		str.append(df.format(priority));
		str.append("\n");
		for (boolean wish : wishes) {
			if (wish) {
				str.append(1);
				str.append(" ");
			} else {
				str.append(0);
				str.append(" ");
			}
		}
		return str.toString();
	}
}